import './App.scss'
import { Router, Route, Switch, Redirect } from 'react-router-dom'
import Layout from '@/pages/layout'
import Login from '@/pages/login'
import ProfileEdit from '@/pages/Profile/Edit/index'
import PrivateRoute from '@/components/PrivateRoute'
import history from './utils/history'
import Chat from '@/pages/Profile/Chat'
import ArticleInfo from '@/pages/Article'
import SearchPage from '@/pages/Home/components/Search'
import Result from './pages/Home/components/Search/Result'
function App() {
  return (
    <Router history={history}>
      <div className="app">
        <Switch>
          <Route
            exact
            path="/"
            render={() => {
              return <Redirect to="/home" />
            }}
          ></Route>
          <Route path="/login" component={Login}></Route>
          <Route path="/home" component={Layout}></Route>
          <Route path="/article/:id" component={ArticleInfo}></Route>
          <Route exact path="/search" component={SearchPage}></Route>
          <Route path="/search/result" component={Result}></Route>
          <PrivateRoute path="/profile/edit">
            <ProfileEdit></ProfileEdit>
          </PrivateRoute>
          <PrivateRoute path="/profile/chat">
            <Chat></Chat>
          </PrivateRoute>
        </Switch>
      </div>
    </Router>
  )
}

export default App
